package com.shujia.base;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;

import java.util.HashSet;

public class RedisJiQun {
    public static void main(String[] args) {
//        Jedis jedis = new Jedis("192.168.233.101",7005);
//
//        jedis.set("address","anhui");
//
//        jedis.close();
        //redis集群java连接方式
        //public JedisCluster(Set<HostAndPort> nodes)
        HashSet<HostAndPort> hostAndPortHashSet = new HashSet<>();
        //public HostAndPort(String host, int port)
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7000));
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7001));
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7002));
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7003));
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7004));
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7005));
        hostAndPortHashSet.add(new HostAndPort("192.168.233.101",7006));
        JedisCluster jedisCluster = new JedisCluster(hostAndPortHashSet);


        jedisCluster.close();
    }
}
